package com.sjn.Client;

import com.sjn.camera.*;

import java.util.Scanner;


public class camerastart implements StartService{
    CameracomposingRoom cameracomposingRoom = null;
    //收集框架
    String fr =null;
    //收集蓝图
    String bp = null;
    //制作
    String m = null;
    Scanner sc=new Scanner(System.in);
    @Override
    public String toString() {
        return "相机{" +
                ", 框架='" + fr + '\'' +
                ", 蓝图='" + bp + '\'' +
                ", 制作情况='" + m + '\'' +
                '}';
    }
    @Override
    public void start(int proess){
        {
            {
                //--------------------代工厂start----------------------
                while(proess==4){
                    System.out.println("-----进入相机制作界面-----");
                    System.out.println("-----按1选择相机代工厂-----");
                    System.out.println("-----按2选择相机蓝图-----");
                    System.out.println("-----按3构造相机框架------");
                    System.out.println("-----按4选择进行相机制作-----");
                    System.out.println("-----按5结束制作进程------");
                    int cameraproess = sc.nextInt();
                    if (cameraproess==5){
                        System.out.println("相机制作结束!");
                        break;
                    }


                    while(cameraproess == 1){
                        //搭建屏幕
                        //创建子线程用于选择代工厂
                        System.out.println("-----按1选择索  尼------");
                        System.out.println("-----按2选择松  下------");
                        int cameraproesss = sc.nextInt();
                        cameracomposingRoom = new CameracomposingRoom();
                        System.out.println("选择:" + cameracomposingRoom.Foundry(cameraproesss));
                        break;
                    }
                    //--------------------代工厂end----------------------
                    //--------------------蓝图start----------------------
                    while (cameraproess==2){
                        if (cameracomposingRoom==null){
                            System.out.println("添加失败,请先选择代工厂");
                            break;
                        }
                        System.out.println("------进入蓝图制作界面------");
                        System.out.println("------请依次输入整数x y 以及需要的技术:");
                        bp =  cameracomposingRoom.Blueprint(sc.nextInt(),sc.nextInt(),sc.nextLine());
                        System.out.println(bp);
                        if (bp!=null){
                            break;
                        }

                    }
                    //--------------------蓝图end----------------------
                    //--------------------制作start----------------------
                    while (cameraproess==4){
                        if (cameracomposingRoom==null){
                            System.out.println("添加失败,请先选择代工厂");
                            break;
                        }
                        System.out.println("------进入制作界面,相机工厂自动制作-----");
                        m = cameracomposingRoom.Production();
                        System.out.println(m);
                        break;
                    }
                    //--------------------制作end----------------------
                    //--------------------框架start----------------------
                    while (cameraproess==3){

                        System.out.println("-----请按1选择镜头工厂-----");
                        System.out.println("-----请按2添加传感器工厂-----");
                        System.out.println("-----请按3完成相机制作-----");

                        int cameraproesss = sc.nextInt();
                        if (cameracomposingRoom==null){
                            System.out.println("添加失败,请先选择代工厂");
                            break;
                        }
                        else if (cameraproesss==1&&cameracomposingRoom!=null){

                            fr = ""+cameracomposingRoom.Frameworks(cameraproesss);

                            System.out.println(fr);
                        }
                        else if (cameraproesss==2&&cameracomposingRoom!=null){
                            fr =fr+ ""+cameracomposingRoom.Frameworks(cameraproesss);

                            System.out.println(fr);
                        }

                        if (cameraproesss==3){
                            break;
                        }




                    }
                    //--------------------框架end----------------------

                }

            }
        }
    }
}
